package com.hong.taotaomall;

import com.hong.taotaomall.entity.Result;
import org.springframework.beans.factory.annotation.Value;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.UUID;

public class reName {
    public static void main(String[] args) {
        File file = new File("C:/Users/27109/Desktop/淘宝图片/车品/天猫汽车/汽车/");
        webpToJpg(file);
    }

    private static void webpToJpg(File src) {
        new File("C:/Users/27109/Desktop/淘宝图片/");
        File[] files = src.listFiles();
        int count = 0;
        if (files != null) {
            for (File file : files) {
                if (!file.isDirectory()) {
                    count++;
                    String name = file.getName();
                    if (name.endsWith(".webp")) {
                        file.renameTo(new File("C:/Users/27109/Desktop/淘宝图片/车品/天猫汽车/汽车/"+"汽车"+count+".jpg"));
                    }
                } else
                    webpToJpg(file);
            }
        }
    }
    private static void deleteOther(File src) {
        File[] files = src.listFiles();
        if (files != null) {
            for (File file : files) {
                if (!file.isDirectory()) {
                    String name = file.getName();
                    if (!name.endsWith(".jpg") || !name.endsWith("txt")) {
                        file.delete();
                    }
                } else
                    webpToJpg(file);
            }
        }
    }

}
